package cn.rongdao.jrkabao.model.cashcoupon;

import com.mifengkong.frtools.http.request.HttpFunction;
import com.mifengkong.frtools.util.FRString;

import java.util.List;

import cn.rongdao.jrkabao.bean.cashcoupon.GetCashCouponBean;
import cn.rongdao.jrkabao.model.api.BaseKaMaoModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 2017/8/14
 */

public class GetCashCouponModel extends BaseKaMaoModel {

    public static GetCashCouponModel getInstance() {
        return getPresent(GetCashCouponModel.class);
    }

    public void execute(int index, Observer<List<GetCashCouponBean>> observer) {
        addParamStrings("coupon_code", FRString.valueOf(index));
        Observable<List<GetCashCouponBean>> observable = mServletApi.getCoupon(mParams).map(new HttpFunction<List<GetCashCouponBean>>());
        toSubscribe(observable, observer);
    }
}